<?php
require '../bin/Common/Message.class.php';
require '../bin/Common/Upload.class.php';
require '../bin/Common/Guid.class.php';
require '../bin/DBA/DB.class.php';
require '../bin/DAL/ProductsDAL.php';
require '../bin/BLL/ProductsBLL.php';
require '../bin/DAL/Parameter.class.php';
$guid = new Guid();
$name = $_POST["txt_Name"];
$photo = $_FILES["file_Img"]["tmp_name"];
$chs_Content = $_POST["art_content1"];
$eng_Content = $_POST["art_content2"];
$deu_Content = $_POST["art_content3"];
$chs_classid = $_POST["chs_select"];
$eng_classid = $_POST["eng_select"];
$deu_classid = $_POST["deu_select"];
$filename = $_FILES["file_Img"]["name"];
$filetype = $_FILES["file_Img"]["type"];
$filesize = $_FILES["file_Img"]["size"];
$message = "";
$chs_arry = array(
			'classid' => $chs_classid,
			'name' => $name,
			'imgurl' => $photo,
			'content' => $chs_Content,
			'guid' => $guid
		);
$eng_arry = array(
			'classid' => $eng_classid,
			'name' => $name,
			'imgurl' => $photo,
			'content' => $eng_Content,
			'guid' => $guid
		);
$deu_arry = array(
			'classid' => $deu_classid,
			'name' => $name,
			'imgurl' => $photo,
			'content' => $deu_Content,
			'guid' => $guid
		);

if ($filename == "")
{
		ProductsBLL::EditByChs_Products_NoPhoto($chs_arry);
		ProductsBLL::EditByEng_Products_NoPhoto($eng_arry);
		ProductsBLL::EditByDeu_Products_NoPhoto($deu_arry);
}
else
{
	if (!Upload::up($filesize,$filetype,$filename,&$message))
	{
		Message::show($message,"-1");
	}
	else
	{
		ProductsBLL::EditByChs_Products($chs_arry);
		ProductsBLL::EditByEng_Products($eng_arry);
		ProductsBLL::EditByDeu_Products($deu_arry);
	}
}
?>